﻿<!doctype html>
<html lang="en-us">

<head>
	<meta charset="utf-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<title>c2d</title>
</head>

<body>

	<canvas id="canvas_nes" tabindex="0"></canvas>

	<pre id="console"></pre>
	<script type="text/javascript" src="c2d.js"></script>

	<button onclick="test()" style="position: absolute; left: 0px; top: 550px;">test</button>

	<script>
		function test(){
			var w = 640;
			var h = 480;
			var buf = new ArrayBuffer(w * h * 4);
			var p = new Uint8ClampedArray(buf);
			for (var y = 0; y < h; y++){
				for (var x = 0; x < w; x++){
					p[(y * w + x) * 4] = 255;
					p[(y * w + x) * 4 + 1] = 0;
					p[(y * w + x) * 4 + 2] = 0;
					p[(y * w + x) * 4 + 3] = 255;
				}
			}
			js_TV_SetPixels(p, w, h);
		}

    </script>
</body>

</html>

